export const getLocal =(key:string)=>{
    let value =localStorage.getItem(key) || "";
    if(value.includes('[') || value.includes('{')){
        value= JSON.parse(value);
    }
    return value
}

export const setLocal =(key:string,value:Object)=>{
    let valueStr= JSON.stringify(value);
    localStorage.setItem(key,valueStr);
}

export const getSession =(key:string)=>{
    let value =sessionStorage.getItem(key) || "";
    return value
}

export const setSession =(key:string,value:any)=>{
    sessionStorage.setItem(key,value);
}

//set windows
window.getLocal=getLocal;
window.setLocal=getLocal;
window.getSession=getSession;
window.setSession=setSession;